#include <iostream>

int main() {
    int sum_day(int month, int day);
    int leap(int year);
    int year, month, day, days;
    printf("input date(year, month, day):");
    scanf("%d %d %d", &year, &month, &day);
    days = sum_day(month, day);
    if (leap(year) && month >= 3) {
        days += 1;
    }
    printf("It is the %dth day in this year!", days);
    return 0;
}

int sum_day(int month, int day) {       // 计算日期
    int day_tab[] = {0, 31, 28, 31, 30, 31, 30 ,31, 31, 30 ,31, 30, 31};
    int i;
    for(i = 1; i < month; i++) {
        day += day_tab[i];      // 累加所在月份之前的月份的所有天数
    }
    return day;
}

int leap(int year) {            // 判断是否为闰年
    int leap;
    leap = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
    return leap;
}